var express = require('express');

module.exports = function (req, res) {

  var up = [];

  var authorization = req.headers['authorization'];

  if (authorization) {

    up = authorization.split(' ');

    up = new Buffer(up[1], 'base64').toString();

    up = up.split(':');
  }

  if (up[0] === 'admin' && up[1] === 'admin') {

    res.json({
      success: true
    });

  } else {

    res.set({
      'www-authenticate': 'Basic realm="hello"'
    });

    res.sendStatus(401)
  }
};